import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.event.KeyEvent;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

/**
 * 
 */

/**
 * @author FTW nt
 *
 */
public class Nyan extends JPanel {
	int x , dx , y , bx;
	Image nyanImage;
	
	public int startPositionX = 1;
	public int startPositionY = 500;
	public int startPositionBX = 1;   

	
	public Nyan(){
		ImageIcon i = new ImageIcon("C:/nyan_cat_tiny.gif");
		nyanImage = i.getImage();
		x = startPositionX;
		y = startPositionY;
		bx = startPositionBX;
	}
	
	public void paint(Graphics g){
		super.paint(g);
		Graphics2D g2d = (Graphics2D) g;
		
		g2d.drawImage(nyanImage ,startPositionX , startPositionY ,  null);
		
		
				
	}
	public void move(){
		x = x + dx;
		bx = bx + dx;
	}
	
	public int getX(){
		return x;
	}
	
	public int getY(){
		return y;
	}
	
	public Image getImage(){
		return nyanImage;
	}
	
	public void keyPressed(KeyEvent e){
		int key = e.getKeyCode();
		
		if (key == KeyEvent.VK_LEFT){
			dx = 0;						//-1 for left movement
		}
		if (key == KeyEvent.VK_RIGHT){
			dx = 1;
		}
	}
	
	public void keyReleased(KeyEvent e){
		int key = e.getKeyCode();
		
		if (key == KeyEvent.VK_LEFT){
			dx = 0;
		}
		if (key == KeyEvent.VK_RIGHT){
			dx = 0;
		}
	}
	

}
